<template>
	<view class="container">
		<u-form :model="form" ref="profileForm">
			<u-form-item label-position="top" label="昵称" :label-style="labelStyle" prop="nickname">
				<u-input v-model="form.nickname" placeholder="请输入你的昵称" />
			</u-form-item>
			<u-form-item label-position="top" label="头像" prop="photo" :label-style="labelStyle">
				<u-input v-model="form.photo" placeholder="点击上传头像" :disabled="true" />
				<u-upload ref="avatarUploadRef" slot="right" width="160" height="160" :max-count="1"></u-upload>
			</u-form-item>
		</u-form>
		<view class="profile-footer">
			<u-button class="u-m-b-80" shape="circle" :custom-style="buttonStyle" hover-class="none" :ripple="true" @click="handleSubmit">保 存</u-button>
			<u-divider>从第三方平台获取个人信息</u-divider>
			<view class="u-flex u-row-center u-m-t-56">
				<image src="/static/login/weixin.png" style="width: 80rpx; height: 80rpx;margin-right: 50rpx;" mode=""></image>
				<image src="/static/login/zhifubao.png" style="width: 80rpx; height: 80rpx;" mode=""></image>
			</view>
		</view>
		<u-modal v-model="modalShow" title="是否立刻注册门店？" :title-style="{fontWeight: 'bold'}" :content-style="contentStyle" :show-cancel-button="true" :confirm-color="themeColor" confirm-text="是" cancel-text="否" @confirm="$mRouter.redirectTo({ route: '/pages/purchase/register' })" @cancel="$mRouter.switchTab({ route: '/pages/mine/index'})">
			<view class="slot-content">
				<rich-text :nodes="modalContent"></rich-text>
			</view>
		</u-modal>
	</view>
</template>

<script>
	export default {
		onNavigationBarButtonTap(e) {
			// 弹出modal框
			// this.modalShow = true
			this.$mRouter.switchTab({ route: '/pages/mine/index'});
		},
		data() {
			return {
				modalShow: false,
				modalContent: `
					开店后您可以以批发价进货哦~<br>
					您也可以在“我”的“设置”中注册门店
				`,
				contentStyle: {
					color: this.greyColor,
					textAlign: 'center',
					lineHeight: '50rpx',
					fontSize: '22rpx',
					padding: '15rpx 0'
				},
				form: {
					nickname: '',
					headImg: ''
				},
				labelStyle: {
					fontSize: '30rpx',
					fontWeight: 'bold'
				},
				buttonStyle: {
					height: '90rpx',
					color: '#FFFFFF',
					background: this.linearGradient
				}
			}
		},
		methods: {
			handleSubmit() {
				this.modalShow = true
			}
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}
</style>

<style lang="scss" scoped>
	.container {
		padding: 75rpx 70rpx 0 70rpx;
	}
	.profile-footer {
		position: absolute;
		bottom: 80rpx;
		text-align: center;
	}
	::v-deep .u-form-item--right__content {
		align-items: flex-end;
	}
</style>
